﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace Rose.Helper
{
    public class CheckDataHelpModel
    {
        public static string CheckLength(string content, int length=20)
        {
            if (string.IsNullOrEmpty(content))
                return string.Empty;
            else
                return content.Substring(0,content.Length> length?length:content.Length);
        }

        public static string FormatLongText(string content, int length = 140)
        {
            if (string.IsNullOrEmpty(content))
                return string.Empty;
            else
            {
                if (content.Length <= length)
                    return content;
                else return content.Substring(0, length-2) + "……";
            }
        }

        public static string FormatSchoolYear(string schoolyear)
        {
            if (!string.IsNullOrEmpty(schoolyear) && schoolyear.Length>2)
            {

                string returnString = schoolyear.Substring(2);
                return returnString + "级";

            }
            return string.Empty;
        }
    
    }
}